module neo.tetris.view {
	/**
	 *
	 * @author 
	 *
	 */
	export class BattleResultWinnerView extends eui.Component {
        public userIcon: eui.Image;
    	
        public matchBtn: eui.Button;
    	
        public constructor(skinName:string) {
            super();

            this.addEventListener(eui.UIEvent.COMPLETE,this.handleEvent,this);
            this.addEventListener(egret.Event.ADDED_TO_STAGE,this.handleEvent,this);
            this.addEventListener(egret.Event.REMOVED_FROM_STAGE,this.handleEvent,this);
            this.skinName = skinName;
        }

        private handleEvent(evt: egret.Event): void {
            switch(evt.type) {
                case egret.Event.ADDED_TO_STAGE:
                    break;
                case egret.Event.REMOVED_FROM_STAGE:
                    break;
                case eui.UIEvent.COMPLETE:
                    this.matchBtn.addEventListener(egret.TouchEvent.TOUCH_TAP,this.handleTouchEvent,this);
                    break;
            }
        }

        private handleTouchEvent(evt:egret.TouchEvent):void {
            Main.instance.battleService.matchAuto();
            this.parent.removeChild(this);
        }
	}
}
